package com.hongxun.design.ui.dialogstyle;

/**
 * Created by zerdoor_pc on 2015/11/9.
 * 加载dialog
 */

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.hongxun.design.R;

public class LoadingDialog extends Dialog {

    public TextView tv;
    public String word = "";

    public LoadingDialog(Context context) {
        super(context, R.style.loadingDialogStyle);
    }

    public LoadingDialog(Context context, String word) {
        super(context, R.style.loadingDialogStyle);
        this.word = word;
    }
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_loading);
        tv = (TextView) findViewById(R.id.tv);
        if (word != "") {
            tv.setText(word);
        } else {
            tv.setText("正在加载.....");
        }
        LinearLayout linearLayout = (LinearLayout) this.findViewById(R.id.linearlayout);
        linearLayout.getBackground().setAlpha(210);

    }
    public void setText(String text){
        if (tv!=null) tv.setText(text);
    }
}